/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.applicatioN.entities;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Asus_k53s
 */
@Entity
@Table(name = "entreprise", catalog = "database", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Entreprise.findAll", query = "SELECT e FROM Entreprise e"),
    @NamedQuery(name = "Entreprise.findByNomEse", query = "SELECT e FROM Entreprise e WHERE e.nomEse = :nomEse"),
    @NamedQuery(name = "Entreprise.findByAdresse", query = "SELECT e FROM Entreprise e WHERE e.adresse = :adresse"),
    @NamedQuery(name = "Entreprise.findByChiffreDAffaires", query = "SELECT e FROM Entreprise e WHERE e.chiffreDAffaires = :chiffreDAffaires"),
    @NamedQuery(name = "Entreprise.findByDateDAffectation", query = "SELECT e FROM Entreprise e WHERE e.dateDAffectation = :dateDAffectation"),
    @NamedQuery(name = "Entreprise.findByDateDOuverture", query = "SELECT e FROM Entreprise e WHERE e.dateDOuverture = :dateDOuverture"),
    @NamedQuery(name = "Entreprise.findByDomaineDActivite", query = "SELECT e FROM Entreprise e WHERE e.domaineDActivite = :domaineDActivite"),
    @NamedQuery(name = "Entreprise.findByEmail", query = "SELECT e FROM Entreprise e WHERE e.email = :email"),
    @NamedQuery(name = "Entreprise.findByMotDePasse", query = "SELECT e FROM Entreprise e WHERE e.motDePasse = :motDePasse"),
    @NamedQuery(name = "Entreprise.findByNombreDEmployes", query = "SELECT e FROM Entreprise e WHERE e.nombreDEmployes = :nombreDEmployes"),
    @NamedQuery(name = "Entreprise.findBySiteWeb", query = "SELECT e FROM Entreprise e WHERE e.siteWeb = :siteWeb"),
    @NamedQuery(name = "Entreprise.findByNumeroDeMatricule", query = "SELECT e FROM Entreprise e WHERE e.numeroDeMatricule = :numeroDeMatricule"),
    @NamedQuery(name = "Entreprise.findByTel", query = "SELECT e FROM Entreprise e WHERE e.tel = :tel")})
public class Entreprise implements Serializable {
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "nomEse")
    private Collection<Poste> posteCollection;
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "NOM_ESE")
    private String nomEse;
    @Basic(optional = false)
    @Column(name = "MOT_DE_PASSE")
    private String motDePasse;
    @Basic(optional = false)
    @Column(name = "DOMAINE_D_ACTIVITE")
    private String domaineDActivite;
    @Basic(optional = false)
    @Column(name = "CHIFFRE_D_AFFAIRES")
    private double chiffreDAffaires;
    @Basic(optional = false)
    @Column(name = "NOMBRE_D_EMPLOYES")
    private int nombreDEmployes;
    @Basic(optional = false)
    @Column(name = "DATE_D_OUVERTURE")
    @Temporal(TemporalType.DATE)
    private Date dateDOuverture;
    @Basic(optional = false)
    @Column(name = "ADRESSE")
    private String adresse;
    @Basic(optional = false)
    @Column(name = "TEL")
    private int tel;
    @Basic(optional = false)
    @Column(name = "EMAIL")
    private String email;
    @Basic(optional = false)
    @Column(name = "SITE_WEB")
    private String siteWeb;
    @Column(name = "DATE_D_AFFECTATION")
    @Temporal(TemporalType.DATE)
    private Date dateDAffectation;
    @JoinColumn(name = "NUMERO_DE_MATRICULE", referencedColumnName = "NUMERO_DE_MATRICULE")
    @ManyToOne(optional = false)
    private Agent numeroDeMatricule;

    public Entreprise() {
    }

    public Entreprise(String nomEse) {
        this.nomEse = nomEse;
    }

    public Entreprise (String nomEse, String adresse, double chiffreDAffaires, Date dateDOuverture, String domaineDActivite, String email, String motDePasse, int nombreDEmployes, String siteWeb, int tel){ 
        this.nomEse = nomEse;
        this.motDePasse = motDePasse;
        this.domaineDActivite = domaineDActivite;
        this.chiffreDAffaires = chiffreDAffaires;
        this.nombreDEmployes = nombreDEmployes;
        this.dateDOuverture = dateDOuverture;
        this.adresse = adresse;
        this.tel = tel;
        this.email = email;
        this.siteWeb = siteWeb;
    }

    public String getNomEse() {
        return nomEse;
    }

    public void setNomEse(String nomEse) {
        this.nomEse = nomEse;
    }

    public String getMotDePasse() {
        return motDePasse;
    }

    public void setMotDePasse(String motDePasse) {
        this.motDePasse = motDePasse;
    }

    public String getDomaineDActivite() {
        return domaineDActivite;
    }

    public void setDomaineDActivite(String domaineDActivite) {
        this.domaineDActivite = domaineDActivite;
    }

    public double getChiffreDAffaires() {
        return chiffreDAffaires;
    }

    public void setChiffreDAffaires(double chiffreDAffaires) {
        this.chiffreDAffaires = chiffreDAffaires;
    }

    public int getNombreDEmployes() {
        return nombreDEmployes;
    }

    public void setNombreDEmployes(int nombreDEmployes) {
        this.nombreDEmployes = nombreDEmployes;
    }

    public Date getDateDOuverture() {
        return dateDOuverture;
    }

    public void setDateDOuverture(Date dateDOuverture) {
        this.dateDOuverture = dateDOuverture;
    }

    public String getAdresse() {
        return adresse;
    }

    public void setAdresse(String adresse) {
        this.adresse = adresse;
    }

    public int getTel() {
        return tel;
    }

    public void setTel(int tel) {
        this.tel = tel;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getSiteWeb() {
        return siteWeb;
    }

    public void setSiteWeb(String siteWeb) {
        this.siteWeb = siteWeb;
    }

    public Date getDateDAffectation() {
        return dateDAffectation;
    }

    public void setDateDAffectation(Date dateDAffectation) {
        this.dateDAffectation = dateDAffectation;
    }

    public Agent getNumeroDeMatricule() {
        return numeroDeMatricule;
    }

    public void setNumeroDeMatricule(Agent numeroDeMatricule) {
        this.numeroDeMatricule = numeroDeMatricule;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nomEse != null ? nomEse.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Entreprise)) {
            return false;
        }
        Entreprise other = (Entreprise) object;
        if ((this.nomEse == null && other.nomEse != null) || (this.nomEse != null && !this.nomEse.equals(other.nomEse))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.applicatioN.entities.Entreprise[ nomEse=" + nomEse + " ]";
    }

    @XmlTransient
    public Collection<Poste> getPosteCollection() {
        return posteCollection;
    }

    public void setPosteCollection(Collection<Poste> posteCollection) {
        this.posteCollection = posteCollection;
    }
    
}
